package com.hsylient.javase.chapter10;

import cn.hutool.system.JavaRuntimeInfo;
import cn.hutool.system.SystemUtil;
import cn.hutool.system.oshi.CpuInfo;
import cn.hutool.system.oshi.OshiUtil;
import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

@Slf4j
public class SystemTest {

    public static void main(String[] args) {
        JavaRuntimeInfo javaRuntimeInfo = SystemUtil.getJavaRuntimeInfo();
        log.info(javaRuntimeInfo.getVersion());
        log.info(javaRuntimeInfo.getClassPath());
        log.info(javaRuntimeInfo.getClassVersion());
        log.info(javaRuntimeInfo.getEndorsedDirs());
        log.info(javaRuntimeInfo.getExtDirs());
        log.info(javaRuntimeInfo.getName());

        CpuInfo cpuInfo = OshiUtil.getCpuInfo();

        log.info(JSON.toJSONString(cpuInfo));
    }

    @Test
    public void testSystemMethod() {
        log.info(System.lineSeparator());
    }
}
